package com.sc.smartcommunity.domain.vo;

import lombok.Data;

@Data
public class ResultVO {
    private Integer code;
    private String msg;
    private Object data;

    public static ResultVO success(Object data) {
        ResultVO result = new ResultVO();
        result.setCode(200);
        result.setMsg("成功");
        result.setData(data);
        return result;
    }

    public static ResultVO fail(String msg) {
        ResultVO result = new ResultVO();
        result.setCode(500);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }

    public ResultVO(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public ResultVO() {
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
